package com.hzdl.springbootdemo.controller;

import com.hzdl.springbootdemo.bean.UserInfo;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author:Asus
 * @date:2020/2/21
 * @description:
 */

@Controller
public class IndexController {

    @RequestMapping("index")
    public String t1(Model model ){

        model.addAttribute("name","小杰伦");
        UserInfo userInfo  = new UserInfo(007,"小杰伦",22, new Date());

        model.addAttribute("student",userInfo);
        List<UserInfo>list = new ArrayList<>();
        list.add(userInfo);
        model.addAttribute("uList,list");

        return "index";
    }

    @RequestMapping("index/login")
    public String login(UserInfo student){
        System.out.println(student);
        return "user";
    }
}
